package TCP.moreClient;
import java.net.ServerSocket;
import java.net.Socket;

/*
* 接收多个客户端发送的数据--》多线程
* */
public class TCPClientDemo2 {
    public static void main(String[] args) throws Exception {
        System.out.println("=====服务器启动=====");
        ServerSocket serverSocket = new ServerSocket(8888);

        while (true){
            Socket socket = serverSocket.accept();
            System.out.println("已连接一个客户端："+socket.getInetAddress().getHostName());
            //3、把这个socket对象交给一个线程处理,读取数据
            new ServerReader(socket).start();
        }
    }
}
